package controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import pojo.User;
import service.UserService;

import javax.annotation.Resource;

@Controller
@RequestMapping("/user")
public class UserController{
    @Resource
    UserService userService;

    @RequestMapping("/list")
    public String userlist(Model model, User user) {
        model.addAttribute("users",userService.getUserInfo(user));
        return "userlist";
    }


    @RequestMapping("/form")
    public String add(Model model, User user) {
        model.addAttribute("user", userService.addUserInfo(user));
        return "add";

    }

    @RequestMapping("/login")
    public  String login(User user){
        userService.Login(user);
        return "blank";
    }
}
